package hotelGUII;
import java.awt.*;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class HomePage extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel contentPane;
private JLabel backgroundLabel, logoLabel, title, tagline;
private JPanel BookNowPanel;
private JLabel welcomeTitleLabel, welcomeDescriptionLabel, whyChooseLabel;
private JLabel location, accommodations, luxury, hospitality, footerLabel;
private JPanel panel_1;
private JButton btnNewButton_2;
private JButton btnNewButton_3;
private JButton btnNewButton_4;
private JButton btnNewButton_5;
private JButton btnNewButton_6;
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
HomePage frame = new HomePage();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public HomePage() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 1119, 787);
setMinimumSize(new Dimension(800,600));
contentPane = new JPanel();
contentPane.setBackground(new Color(101, 67, 33));
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
createComponents();
addComponentListener(new java.awt.event.ComponentAdapter() {
public void componentResized(java.awt.event.ComponentEvent evt) {
resizeComponents();
}
});
}
private void createComponents() {
// Logo and Title
logoLabel = new JLabel("");
logoLabel.setBounds(20, 50, 159, 142);
ImageIcon LogoIcon = new ImageIcon(getClass().getResource("/logo-no-bg.png"));
Image imgLogo = LogoIcon.getImage().getScaledInstance(159, 142, Image.SCALE_SMOOTH);
contentPane.setLayout(null);
logoLabel.setIcon(new ImageIcon(imgLogo));
contentPane.add(logoLabel);
title = new JLabel("Velora Heights Lipa");
title.setBounds(189, 81, 387, 60);
title.setForeground(new Color(255, 255, 255));
title.setFont(new Font("Times New Roman", Font.BOLD, 42));
contentPane.add(title);
tagline = new JLabel("Your Premier Budget Stay in Lipa City");
tagline.setBounds(199, 134, 508, 41);
tagline.setFont(new Font("Source Sans Pro", Font.PLAIN, 18));
tagline.setForeground(new Color(255, 255, 255));
contentPane.add(tagline);
String[] panelLabels = {"Home", "About", "Location", "Gallery", "Rooms", "Contact", "Profile"};
int panelX = 0;
for (String label : panelLabels) {
JPanel panel = new JPanel();
panel.setBounds(panelX, 0, label.equals("Contact") ? 115 : 99, 34);
panel.setBackground(Color.WHITE);
panel.setLayout(new FlowLayout(FlowLayout.CENTER));
navBar.add(panel);
JLabel panelLabel = new JLabel(label);
panelLabel.setFont(new Font("Source Sans Pro", Font.PLAIN, 16));
panelLabel.setForeground(Color.BLACK);
panel.add(panelLabel);
// Add action listener for "About" panel
if (label.equals("About")) {
panel.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
// Open AboutUs page when the "About" panel is clicked
AboutUs aboutPage = new AboutUs();
aboutPage.setVisible(true);
dispose(); // Close the current window (optional)
}
});
}
panelX += (label.equals("Contact") ? 115 : 99);
}
// "Book Now" Panel
BookNowPanel = new JPanel();
BookNowPanel.setBounds(929, 185, 122, 40);
BookNowPanel.setBackground(Color.WHITE);
BookNowPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
JLabel bookNowLabel = new JLabel("Book Now");
bookNowLabel.setFont(new Font("Times New Roman", Font.BOLD, 14));
bookNowLabel.setForeground(new Color(101, 67, 33));
BookNowPanel.add(bookNowLabel);
contentPane.add(BookNowPanel);
// Background Image
backgroundLabel = new JLabel("");
backgroundLabel.setBounds(0, 0, 1119, 243);
ImageIcon backgroundIcon = new ImageIcon(getClass().getResource("/background-pic.png"));
Image img = backgroundIcon.getImage().getScaledInstance(getWidth(), 252, Image.SCALE_SMOOTH);
backgroundLabel.setIcon(new ImageIcon(img));
contentPane.add(backgroundLabel);
// HomePage Content (WelcomePage Components)
welcomeTitleLabel = new JLabel("Welcome to VELORA Heights Lipa");
welcomeTitleLabel.setForeground(Color.WHITE);
welcomeTitleLabel.setFont(new Font("Times New Roman", Font.BOLD, 42));
welcomeTitleLabel.setHorizontalAlignment(SwingConstants.CENTER);
contentPane.add(welcomeTitleLabel);
welcomeDescriptionLabel = new JLabel("<html><center>Discover the perfect blend of luxury, comfort, and affordability at VELORA Heights Lipa, your premier destination for exceptional accommodations in the heart of Lipa City, Batangas.</center></html>");
welcomeDescriptionLabel.setForeground(Color.WHITE);
welcomeDescriptionLabel.setFont(new Font("Times New Roman", Font.PLAIN, 18));
welcomeDescriptionLabel.setHorizontalAlignment(SwingConstants.CENTER);
contentPane.add(welcomeDescriptionLabel);
whyChooseLabel = new JLabel("Why Choose VELORA Heights Lipa?");
whyChooseLabel.setForeground(Color.WHITE);
whyChooseLabel.setFont(new Font("Times New Roman", Font.BOLD, 32));
whyChooseLabel.setHorizontalAlignment(SwingConstants.LEFT);
contentPane.add(whyChooseLabel);
location = new JLabel("<html><center> • Prime Location: Situated in the vibrant and thriving city of Lipa, our hotel provides easy access to key attractions, shopping centers, and dining options.</center></html>");
location.setForeground(Color.WHITE);
location.setFont(new Font("Times New Roman", Font.PLAIN, 18));
location.setHorizontalAlignment(SwingConstants.LEFT);
contentPane.add(location);
accommodations = new JLabel("<html><center> • Elegant Accommodations: Choose from our carefully designed rooms Deluxe, Executive, and Suite each offering modern amenities and a tranquil ambiance.</center></html>");
accommodations.setForeground(Color.WHITE);
accommodations.setFont(new Font("Times New Roman", Font.PLAIN, 18));
accommodations.setHorizontalAlignment(SwingConstants.LEFT);
contentPane.add(accommodations);
luxury = new JLabel("<html><center> • Affordable Luxury: Experience premium services and facilities at prices that won't break the bank.</center></html>");
luxury.setForeground(Color.WHITE);
luxury.setFont(new Font("Times New Roman", Font.PLAIN, 18));
luxury.setHorizontalAlignment(SwingConstants.LEFT);
contentPane.add(luxury);
hospitality = new JLabel("<html><center> • Outstanding Hospitality: Our dedicated team ensures your stay is seamless, comfortable, and memorable.</center></html>");
hospitality.setForeground(Color.WHITE);
hospitality.setFont(new Font("Times New Roman", Font.PLAIN, 18));
hospitality.setHorizontalAlignment(SwingConstants.LEFT);
contentPane.add(hospitality);
footerLabel = new JLabel("<html><center>Explore our system to learn more about our offerings and make your reservation today. VELORA Heights Lipa awaits to welcome you with open arms.</center></html>");
footerLabel.setForeground(Color.WHITE);
footerLabel.setFont(new Font("Times New Roman", Font.PLAIN, 18));
footerLabel.setHorizontalAlignment(SwingConstants.CENTER);
contentPane.add(footerLabel);
panel_1 = new JPanel();
panel_1.setBounds(0, 242, 1105, 41);
contentPane.add(panel_1);
panel_1.setLayout(null);
JButton btnHomeButton = new JButton("Home");
btnHomeButton.setBounds(10, 0, 109, 41);
panel_1.add(btnHomeButton);
JButton btnLocationButton = new JButton("Location");
btnLocationButton.setBounds(232, 0, 85, 41);
panel_1.add(btnLocationButton);
btnNewButton_2 = new JButton("About");
btnNewButton_2.setBounds(129, 0, 93, 41);
panel_1.add(btnNewButton_2);
btnNewButton_3 = new JButton("Rooms");
btnNewButton_3.setBounds(423, 0, 85, 41);
panel_1.add(btnNewButton_3);
btnNewButton_4 = new JButton("Gallery");
btnNewButton_4.setBounds(328, 0, 85, 41);
panel_1.add(btnNewButton_4);
btnNewButton_5 = new JButton("Contact");
btnNewButton_5.setBounds(518, 0, 85, 41);
panel_1.add(btnNewButton_5);
btnNewButton_6 = new JButton("Profile");
btnNewButton_6.setBounds(613, 0, 85, 41);
panel_1.add(btnNewButton_6);
// Positioning the WelcomePage Components
resizeComponents();
}
private void resizeComponents() {
int width = getWidth();
int padding = 50;
int contentWidth = width - (2 * padding);
logoLabel.setBounds(20, 50, 159, 142);
title.setBounds(189, 81, contentWidth, 60);
tagline.setBounds(199, 134, contentWidth, 41);
welcomeTitleLabel.setBounds(50, 316, contentWidth, 50);
welcomeDescriptionLabel.setBounds(50, 367, contentWidth, 80);
whyChooseLabel.setBounds(304, 477, contentWidth, 40);
location.setBounds(35, 540, contentWidth, 50);
accommodations.setBounds(35, 600, contentWidth, 50);
luxury.setBounds(50, 649, contentWidth, 50);
hospitality.setBounds(50, 700, contentWidth, 50);
footerLabel.setBounds(padding, 740, contentWidth, 60);
BookNowPanel.setLocation(width - BookNowPanel.getWidth() - 50, BookNowPanel.getY());
contentPane.revalidate();
contentPane.repaint();
}
}